package com.chenl.provider.DEMOS.缓存预热;

import com.chenl.provider.util.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
public class StudentCache extends AbstractCache{
    @Autowired
    RedisService redisService;
    @Override
    public void initCache() {
        Map<String,String> map=new HashMap<>();
        for (int i = 10000; i < 20000; i++) {
            map.put("key"+i,String.valueOf(i));
        }
        long l = System.currentTimeMillis();
//        redisService.setKeysByPipeline(map);
        long l2 = System.currentTimeMillis();
        long time=l2- l;
        System.out.println("管道处理耗时："+time+"毫秒");
    }
}
